package com.leo.erp.enums;

public enum DepotItemStateEnum {
	CHECK(0, "审核中"), OFFLINE(-1, "非法操作"), SUCCESS(1, "操作成功"), DELETE(2, "强制删除"), INNER_ERROR(-1001, "内部系统错误");
	private int state;
	private String stateInfo;
	
	private DepotItemStateEnum(int state, String stateInfo) {
		this.state = state;
		this.stateInfo = stateInfo;
	}
	
	/**
	 * 依据传入的state返回相应的enum值
	 * 
	 * @param state
	 * @return
	 */
	public static DepotItemStateEnum stateOf(int state) {
		for(DepotItemStateEnum stateEnum : values()) {
			if(stateEnum.getState() == state) {
				return stateEnum;
			}
		}
		return null;
	}

	public int getState() {
		return state;
	}

	public String getStateInfo() {
		return stateInfo;
	}
}
